<?php include '_header.php';?>
<body>
<?php include '_menu.php';?>
<div class="container-fluid">
    <div class="row">
        <?php include '_left.php';?>

        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" id="condiacc">
            
            <br/>
                <ol class="breadcrumb">
                    <li><a href="index.html"><span class="glyphicon glyphicon-home"></span>&nbsp;后台首页</a></li>
                    <li class="active">系统管理 - </li>
                </ol>
                <div class="input-group line left">
                    <span class="input-group-addon" id="basic-addon2"><span class="glyphicon glyphicon-search"></span></span>
                    <input type="text" class="form-control" placeholder="输入关键字搜索" aria-describedby="basic-addon2">
                </div>
                <a href="#" class=" btn btn-primary "><span class="glyphicon glyphicon-search"></span></a>
                <br/><br/>

            <h2 class="sub-header"><a class="btn btn-primary btn-sm" href="<?=site_url('manage/add/'.$current_table)?>" role="button">添加</a></h2>
            <div class="chart">
            <div class="table-responsive">
                <table class="table table-bordered table-striped text-center bg-info">
                    <thead>
                    <tr class="info">
                        <?php if(!empty($fields)):?>
                        <?php foreach ($fields as $key => $value):?>
                        <th class="text-center"><?=$value['column_comment']?></th>
                        <?php endforeach;?>
                        <td>操作</td>
                        <?php endif; ?>
                    </tr>
                    </thead>
                    <tbody>
                        <?php if(!empty($rows)):?>
                            <?php foreach ($rows as $row):?>
                            <tr>
                                <?php $row_keys = array_keys($row); ?>
                                <?php foreach ($row_keys as $key): ?>
                                    <td>
                                        <?php
                                            $value = strip_tags($row[$key]);
                                            echo mb_strlen($value)>30?mb_substr($value,0,30).'...':$value;
                                        ?>
                                    </td>
                                <?php endforeach ?>
                                <td>
                                    <a class="btn btn-primary btn-sm" href="<?php echo site_url("manage/edit/{$current_table}/{$row['id']}") ?>">编辑</a>
                                    <a class="btn btn-primary btn-sm" href="<?php echo site_url("manage/delete/{$current_table}/{$row['id']}") ?>" onclick="javascript:return confirm('你确定要删除吗?');">删除</a>
                                </td>
                            </tr>
                            <?php endforeach;?>
                        <?php else:?>
                            <tr>
                                <td style="color:red;font-weight:bold;font-size:2em;">
                                    没有查询到数据.
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
            <div class='pagination right'><?php if(!empty($pages)){echo $pages;}?></div>
            </div>
        </div>
    </div>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</body>
</html>
